﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3.Reports
{
    using Reports.JobDetailsTableAdapters;
   
    using Reports;
    using AllTaskTableAdapters;
    public partial class DailyReportForm : Form
    {
        
        public DailyReportForm()
        {
            InitializeComponent();
        }

        private void btnSubmit_Click(object sender, EventArgs e)

        {
            // JobDetails.TblJobCodeDataTable details1 = new JobDetails.TblJobCodeDataTable();
            //JobCodeTableAdapter jbcode= new JobCodeTableAdapter();
            //jbcode.Connection=new System.Data.OleDb.OleDbConnection(Program.ConnStr);

            DailyReport dailyrpt = new DailyReport();
            DailyJobcodeTableAdapter jobcode = new DailyJobcodeTableAdapter();
            driverpaymentmastertableTableAdapter drvrpt = new driverpaymentmastertableTableAdapter();
            consolidation_mastertableTableAdapter consoladapt = new consolidation_mastertableTableAdapter();
            companypaymentmastertableTableAdapter companypamnt = new companypaymentmastertableTableAdapter();
            driverpaymentmastertableTableAdapter drvrpaymntadapt = new driverpaymentmastertableTableAdapter();
            merchandisermasterTableAdapter merchd = new merchandisermasterTableAdapter();

            dailyrpt.SummaryInfo.ReportTitle =  "Report for " + dateTimePicker1.Value.Date.ToShortDateString() ;

            //use jobcode.GetDataBy(dateTimePicker1.Value.Date)
            dailyrpt.Subreports["DailyJobCode.rpt"].SetDataSource((DataTable)jobcode.GetData());
            dailyrpt.Subreports["DailyDriver.rpt"].SetDataSource((DataTable)drvrpaymntadapt.GetData());
            dailyrpt.Subreports["DailyConsolidation.rpt"].SetDataSource((DataTable)consoladapt.GetData());
            dailyrpt.Subreports["DailyCompanyPayment.rpt"].SetDataSource((DataTable)companypamnt.GetData());
            dailyrpt.Subreports["DailymerchandiasingReport.rpt"].SetDataSource((DataTable)merchd.GetData());


            crystalReportViewer1.ReportSource = dailyrpt;
            crystalReportViewer1.Refresh();
           
        }



    }
}
